﻿using Omabar.BLL;
using Omabar.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Omabar.CMS.Mobile
{
    public partial class RouteDetail : System.Web.UI.Page
    {
        protected string id;
        protected ROUTE route;
        protected List<PHOTO> photos;
        protected PACKAGE package;
        protected void Page_Load(object sender, EventArgs e)
        {
            Route_BLL routeBLL = new Route_BLL(); 
            Photo_BLL photoBLL = new Photo_BLL();
            if (!IsPostBack)
            {
                id = Request["id"];
                route = routeBLL.GetModel(id);

                //图库
                photos = photoBLL.GetModels(string.Format("SELECT TOP 10 T.PHOTO_ID,PHOTO_NAME,PHOTO_URL,PHOTO_DES,PHOTO_HOT,PHOTO_COVER FROM ROUTE_GALLERY T LEFT JOIN PHOTO V ON T.PHOTO_ID=V.PHOTO_ID WHERE T.ROUTE_ID='{0}'", id));
                if (photos == null) photos = new List<PHOTO>();

                Package_BLL packageBLL = new Package_BLL();
                package = packageBLL.GetModelBySQL(string.Format("SELECT PACKAGE_ID,PACKAGE_DES,PACKAGE_INCLUDE,PACKAGE_EXCLUDE FROM PACKAGE WHERE PACKAGE_ID IN (SELECT PACKAGE_ID FROM ROUTE_PACKAGE WHERE ROUTE_ID='{0}')", route.ROUTE_ID));
                
            }
        }
    }
}